import pygame
from pygame.locals import *
from sys import exit

image_filename = 'pygame.jpg'

pygame.init()
screen = pygame.display.set_mode((400, 300))
pygame.display.set_caption("Moving with arrows")
img = pygame.image.load(image_filename)
x = 0
y = 150
while True:
    screen.fill((255, 255, 255))
    screen.blit(img, (x, y))
    for event in pygame.event.get():
        if event.type == QUIT:
            exit()

        keys = pygame.key.get_pressed()
        if keys[K_d]:
            x = x + 5
        if keys[K_a]:
            x = x - 5
        if keys[K_x]:
            y = y + 5
        if keys[K_w]:
            y = y - 5
        if keys[K_z]:
            x = x - 5
            y = y + 5
        if keys[K_c]:
            x = x + 5
            y = y + 5
        if keys[K_e]:
            x = x + 5
            y = y - 5
        if keys[K_q]:
            x = x - 5
            y = y - 5
    pygame.display.update()
